package cn.mumzone.pos.api.service;

import java.util.HashMap;
import java.util.List;

import cn.mumzone.basic.net.response.BaseResponse;
import cn.mumzone.basic.net.response.PageListResponse;
import cn.mumzone.pos.model.GoodsEntity;
import cn.mumzone.pos.model.InWarehouseItemEntity;
import cn.mumzone.pos.model.InventoryDetailEntity;
import cn.mumzone.pos.model.InventoryGoodsEntity;
import cn.mumzone.pos.model.InventoryGoodsResult;
import cn.mumzone.pos.model.InventoryItemEntity;
import cn.mumzone.pos.model.MemberEntity;
import cn.mumzone.pos.model.OutWarehouseDetailEntity;
import cn.mumzone.pos.model.OutWarehouseItemEntity;
import cn.mumzone.pos.model.RepoGoodsEntity;
import cn.mumzone.pos.model.RepoListGoodsEntity;
import cn.mumzone.pos.model.RepositoryEntity;
import cn.mumzone.pos.model.WarehouseDetailEntity;
import okhttp3.RequestBody;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by qiuzhenhuan on 2019/7/31.
 */

public interface StockService {

    @POST("egg_stock/api/v1/stock/warehouse/getRepositoryListPage")
    Observable<Response<BaseResponse<PageListResponse<RepositoryEntity>>>> getRepositoryListPage();


//    @FormUrlEncoded
////    @POST("egg_goods/api/v1/goods/findGoodsByBarCode")
//    @POST("egg_stock/api/v1/stock/repositoryGoods/findPosInOutBoundGoodsList")
//    Observable<Response<BaseResponse<PageListResponse<RepoListGoodsEntity>>>> findGoodsByBarCode(@Field("repositoryId") String repositoryId,
//                                                                                                 @Field("primaryClassifyId") String primaryClassifyId,
//                                                                                                 @Field("keyWord") String keyword,
//                                                                                                 @Field("pageNum") String pageNum,
//                                                                                                 @Field("pageSize") String pageSize,
//                                                                                                 @Field("type") String type);

    @POST("egg_stock/api/v1/stock/repositoryGoods/findPosInOutBoundGoodsList")
    Observable<Response<BaseResponse<PageListResponse<RepoListGoodsEntity>>>> findGoodsByBarCode(@Body RequestBody body);

    @FormUrlEncoded
    @POST("egg_stock/api/v1.5/repertory/inventoryListPage")
    Observable<Response<BaseResponse<PageListResponse<InventoryItemEntity>>>> getInventoryList(@Field("pageSize") String pageSize,
                                                                                               @Field("pageNum") String pageNum,
                                                                                               @Field("inventoryType") String inventoryType,
                                                                                               @Field("inventoryStatus") String inventoryStatus,
                                                                                               @Field("startTime") String startTime,
                                                                                               @Field("endTime") String endTime,
                                                                                               @Field("keyword") String keyword);

    @FormUrlEncoded
    @POST("egg_stock/api/v1/repertoryInBound/getRepertoryInBoundListPage")
    Observable<Response<BaseResponse<PageListResponse<InWarehouseItemEntity>>>> getInWarehouseList(@Field("pageSize") String pageSize,
                                                                                                   @Field("pageNum") String pageNum,
                                                                                                   @Field("inType") String inType,
                                                                                                   @Field("inStatus") String inStatus,
                                                                                                   @Field("startTime") String startTime,
                                                                                                   @Field("endTime") String endTime,
                                                                                                   @Field("inCode") String inCode);

    @FormUrlEncoded
    @POST("egg_stock/api/v1/repertoryOutBound/getRepertoryOutBoundListPage")
    Observable<Response<BaseResponse<PageListResponse<OutWarehouseItemEntity>>>> getOutWarehouseList(@Field("pageSize") String pageSize,
                                                                                                     @Field("pageNum") String pageNum,
                                                                                                     @Field("outType") String outType,
                                                                                                     @Field("outStatus") String outStatus,
                                                                                                     @Field("startTime") String startTime,
                                                                                                     @Field("endTime") String endTime,
                                                                                                     @Field("outCode") String outCode);

    @GET("egg_stock/api/v1/repertoryInBound/getRepertoryInBoundDetailGroup")
    Observable<Response<BaseResponse<WarehouseDetailEntity>>> getInWarehouseDetail(@Query("id") String id);

    @GET("egg_stock/api/v1/repertoryOutBound/getRepertoryOutBoundDetailGroup")
    Observable<Response<BaseResponse<OutWarehouseDetailEntity>>> getOutWarehouseDetail(@Query("id") String id);

    @FormUrlEncoded
    @POST("egg_stock/api/v1/repertory/addInventory")
    Observable<Response<BaseResponse<String>>> addInventory(@FieldMap HashMap<String, String> requestMap);

    @FormUrlEncoded
    @POST("egg_stock/api/v1/repertoryOutBound/addRepertoryOutBound")
    Observable<Response<BaseResponse<Object>>> addStockOut(@FieldMap HashMap<String, String> requestMap);

    @FormUrlEncoded
    @POST("egg_stock/api/v1/repertoryInBound/addRepertoryInBound")
    Observable<Response<BaseResponse<String>>> addStockIn(@FieldMap HashMap<String, String> requestMap);

    @GET("egg_stock/api/v1.5/repertory/inventoryDetails")
    Observable<Response<BaseResponse<InventoryDetailEntity>>> inventoryDetails(@Query("id") String orderId);


    @POST("egg_stock/api/v1/stock/RepertoryGoodsInventory/inventoryGoodsDetail")
    Observable<Response<BaseResponse<InventoryGoodsResult>>> inventoryGoodsDetail(@Body RequestBody requestBody);

    @POST("egg_stock/api/v1.5/repertory/inventoryGoodsNum")
    Observable<Response<BaseResponse<Object>>> inventoryGoodsNum(@Body RequestBody requestBody);


    @POST("egg_stock/api/v1/repertory/inTheInventory")
    Observable<Response<BaseResponse<List<GoodsEntity>>>> inTheInventory(@Body RequestBody requestBody);


    @FormUrlEncoded
    @POST("egg_stock/api/v1.5/repertory/updateInventoryStatus")
    Observable<Response<BaseResponse<Object>>> updateInventoryStatus(@Field("id") String orderId,
                                                                     @Field("inventoryStatus") String inventoryStatus,
                                                                     @Field("auditRemark") String auditRemark);

}
